//
//  MineCommentCell.m
//  jiyujiaProgram
//
//  Created by Jame on 15/12/15.
//  Copyright © 2015年 中良 赵. All rights reserved.
//

#import "MineCommentCell.h"
#import "CommentModel.h"

@implementation MineCommentCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setCellWithModel:(NSArray *)model WithIndexPath:(NSIndexPath *)index
{
    CommentData *data = model[index.row];
    self.nameLabel.text = data.mName;
    
    CGFloat score = ([data.teaching_attitude integerValue] + [data.dressing integerValue] + [data.describe_score integerValue])/3;
    
    self.starView.starImage = ECIMAGENAME(@"star_gray.png");
    self.starView.starHighlightedImage = ECIMAGENAME(@"star_orange.png");
    self.starView.maxRating = 5.0;
    self.starView.horizontalMargin = 12.0;
    self.starView.editable = NO;
    self.starView.rating = score;
    self.starView.displayMode = EDStarRatingDisplayFull;
    self.starView.backgroundColor = [UIColor clearColor];
    
    if (score <2) {
        _statusLabel.text = @"差评";
    }else if((score >=2) && (score<4)){
        _statusLabel.text = @"中评";
    }else if (score>= 4){
        _statusLabel.text = @"好评";
    }
    _commentLabel.text = data.content;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
